<style type="text/css">
    .layui-table-body{overflow-x:auto;}
    .layui-table-cell{font-size:12px;}
</style>
<div class="layui-form hisi-search">
    <form action="{:url()}" method="get" id="hisi-table-search">
        <input type="hidden" name="user_id" class="layui-input field-user_id" value="{$user_id}">
        <div class="layui-form-item">
            <label class="layui-form-label">疗程卡名称</label>
            <div class="layui-input-block">
                <!-- <input type="text" name="card_name" class="layui-input field-card_name" lay-verify="required" placeholder="疗程卡名称" /> -->
                <select name="cid" class="layui-input field-cid" lay-verify="required" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    {volist name="card_arr" id="vo"}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                  </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <select name="type" class="layui-input field-type" lay-verify="required" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <option value="1">买入</option>
                    <option value="2">使用</option>
                    <option value="3">退卡</option>
                    <option value="4">赠送</option>
                  </select>
            </div>
        </div>

        
        <div class="layui-form-item">
            <label class="layui-form-label">金额</label>
            <div class="layui-input-block">
                <input type="text" name="price" class="layui-input field-price" lay-verify="required" placeholder="金额" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">期初数量</label>
            <div class="layui-input-block">
                <input type="text" name="start_num" class="layui-input field-start_num" lay-verify="required" placeholder="期初数量" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">变更数量</label>
            <div class="layui-input-block">
                <input type="text" name="use_num" class="layui-input field-use_num" lay-verify="required" placeholder="变更数量" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结余数量</label>
            <div class="layui-input-block">
                <input type="text" name="end_num" class="layui-input field-end_num" lay-verify="required" placeholder="结余数量" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block">
              <input type="text" class="layui-input field-start" id="start" name="start" placeholder="yyyy-MM-dd">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
              <input type="text" class="layui-input field-end" id="end" name="end" placeholder="yyyy-MM-dd">
            </div>
          </div>
        <div class="layui-form-item hisi-search-btn">
            <div class="layui-input-block" style="width: 300px;">
                <button type="submit" class="layui-btn layui-btn-normal layui-icon layui-icon-search">查询</button>
                <!-- <button type="reset" class="layui-btn layui-btn-primary layui-icon layui-icon-delete">重置</button> -->
                <!-- <button type="button" class="layui-btn layui-btn-warm layui-icon layui-icon-download-circle export">导出</button> -->
            </div>
        </div>
    </form>
</div>
<table id="dataTable"></table>
<script type="text/html" id="usernameTpl">
    <div style="line-height:18px;">
    <p class="ml10 fl"><strong class="mcolor">{{ d.username }} ({{ d.nick }})</strong><br>手机：{{ d.mobile }}<br>邮箱：{{ d.email }}</p></div>
</script>
<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '550px', height: '420px', title: '修改会员'}">修改</a><a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>

</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    <a href="{:url('add')}" class="layui-btn layui-btn-normal layui-btn-sm hisi-iframe-pop" hisi-data="{width: '550px', height: '420px', title: '添加会员'}">&nbsp;添加</a>

    <a data-href="{:url('del')}" class="layui-btn layui-btn-danger j-page-btns confirm layui-btn-sm">&nbsp;删除</a>
</script>
<script type="text/javascript">
    layui.use(['table','laydate'], function() {
        var table = layui.table;
        var laydate = layui.laydate;
               //日期范围
        laydate.render({
            elem: '#start'
        });
        laydate.render({
            elem: '#end'
        });
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}?user_id={$user_id}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            // ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[ //表头
                {type:'checkbox'}
                ,{field: 'user_name', title: '会员'}
                ,{field: 'card_name', title: '疗程卡名称'}
                ,{field: 'type_text', title: '状态'}
                ,{field: 'price', title: '价格'}
                ,{field: 'start_num', title: '期初数量'}
                ,{field: 'use_num', title: '变更数量'}
                ,{field: 'end_num', title: '结余数量'}
                ,{field: 'createtime', title: '购买时间',sort:true}
                // ,{title: '操作', width: 150, templet: '#buttonTpl'}
            ]]
            ,done: function(){
                if (typeof(layui.global.addTableTool) !== 'undefined') {
                    layui.global.addTableTool();
                }
            }
        });
    });
</script>
